var height = argument0;
var width = argument1;
var corridorSize = argument2;
var roomSize = argument3
var seed = argument4;
var dungeon = dungeonFactory(height, width, seed, 0);


var path;
var rooms;

for(var i = height - 1; i >= 0; i--)
{
    for(var j = width - 1; j >= 0; j--)
    {
        path[i, j] = 0;
        rooms[i, j] = 0;
    }
}

growingTreeV3(path, corridorSize, seed);
markEnds(path);
pruneTreeV2(path);

writeArray2D(path);
show_debug_message("");

seedRooms(rooms, path);

writeArray2D(rooms);
show_debug_message("");

//needs walls and entrance/ exits
var roomModules = createRooms(rooms, path, roomSize);
for (var i = 0; i < array_length_1d(roomModules); i++)
{
    layerModule(dungeon, roomModules[i]);
}

writeArray2D(rooms);
show_debug_message("");

createPath(dungeon, path, rooms);
createWalls(dungeon);
return dungeon;
// 0 = wall
// 1 = path
// A = start
// B = finish